package object_;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;

public class Test4 {
    public static void main(String[] args) {
        String path="D:\\javacode\\javacode\\IO_1\\out.txt";//打印流输出的位置
        PrintWriter printWriter=null;

        PrintStream printStream=System.out;// //在默认情况下，PrintStream 输出数据的位置是 标准输出，即显示器
        printStream.println("hello 2025");//如同System.out.println("hello 2025");

        try {
            printWriter=new PrintWriter(new FileWriter(path));//这样使用同字符流
            printWriter.print("hello");//将hello写到path路径

        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            printWriter.close();
        }
    }
}
